﻿$def with (article, comment, prev, next)

$def ff_linebreak():
    <script type="text/javascript">
    function toBreakWord(intLen, id){
    var obj=document.getElementById(id);
    var strContent=obj.innerHTML;
    var strTemp="";
    while(strContent.length>intLen){
    strTemp+=strContent.substr(0,intLen)+"<br>";
    strContent=strContent.substr(intLen,strContent.length);
    }
    strTemp+= strContent;
    obj.innerHTML=strTemp;
    }
    </script> 
    
$var title: view blog
$var scripts: $ff_linebreak()

<div id="content" class="widecolumn">

<div class="navigation">
<div class="alignleft">&laquo; 
$if prev == None:
    没有了
$else:
    <a href="../view/$prev.id">$prev.title</a>
</div>
<div class="alignright">&raquo;
$if next == None:
    没有了
$else:
    <a href="../view/$next.id">$next.title</a>
</div>
</div>

<div class="post">
$if article[0]:
    <h2>$article[0].title</h2>
    <i><span class="timestamp">posted at $article[0].published_when.strftime("%H:%M:%S %m-%d-%Y")</span></i>
    <div class="entry"> 
      $article[0].body
    </div>
    <script type="javascript">toBreakWord(60, "wrap");</script>
    <p>
      <a href="../edit/$article[0].id">edit</a> |
        <a href="./$article[0].id">view</a>
    </p>
 
<h3 id="comments">Responses to &#8220;$article[0].title&#8221;</h3>
<ol class="commentlist">
$for row in comment:
    <li class="alt">
    $row.author Says:
    <br />
    <small class="commentmetadata">$row.date.strftime("%H:%M:%S %m-%d-%Y")</small>
    <p>$row.content</p>
    </li>
</ol>

<form action="/comment" method="post">
<label for="post_username">name</label><br />
<input id="post_username" type="text" name="post_username" class="textbox"/><br />
<label for="post_body">say something!</label><br />
<textarea id="post_body" name="post_body" cols="60" rows="8" class="textbox"></textarea><br />
<input type="hidden" name="post_id" value="$article[0].id" />
<input type="submit" name="post_submit" value="GO" />
</form>

</div>
</div>
